import React,{useContext} from 'react';
import ReactDOM from 'react-dom';
import {Provider} from 'react-redux';
import App from './App';
import {CreateContext} from './Context/createContext'
import {BrowserRouter as Router,Route,Switch,Redirect} from 'react-router-dom'
import {mainRouter} from './routers';
import {UPDATEURLIMG} from './api/config/config';
const config= {
            apiUrl:{UPDATEURLIMG}
        }
ReactDOM.render(  
    <CreateContext.Provider value={config }>
        <Router>
                <Switch>
            
                    <Route path="/admin"  component={App}/>
                    {
                        mainRouter.map(rote=>{
                        return  <Route
                                key={rote.pathname}
                                path={rote.pathname}
                                exact
                                component={rote.component}
                                >

                        </Route>
                        })
                    }
                    <Redirect to="/admin" exact from="/"/>
                    <Redirect to="/404"  ></Redirect>
                </Switch>
            </Router>
    </CreateContext.Provider>  
  
    
, document.getElementById('root'));


